import { defineStore } from 'pinia';
import { ref } from 'vue';
import type { CommandSender } from '../commandHelper';

type SendUserCmd = CommandSender<any, any> | null;

// 1. 先按原来的方式定义Store（完全不变）
export const useUserStore = defineStore('userInjection', () => {
  const sendUserCmd = ref<SendUserCmd>(null);

  const setInjections = (injections: { sendUserCmd?: SendUserCmd }) => {
    if (injections.sendUserCmd) {
      sendUserCmd.value = injections.sendUserCmd;
    }
  };

  return { sendUserCmd, setInjections };

});